package thread.guarded;


public class Main {
    public static void main(String[] args) {
        // 启动执行器
        RequestQueue requestQueue = new RequestQueue();
        Thread alice = new ClientThread(requestQueue, "Alice", 314159L);
        Thread bobby = new ServerThread(requestQueue, "Bobby", 265358L);
        alice.start();
        bobby.start();
        try {
            // 等待约10s
            Thread.sleep(10000);
        } catch (InterruptedException e) {

        }
        System.out.println("***** calling interrupt *****");
        // 呼叫interrupt方法
        alice.interrupt();
        bobby.interrupt();
    }
}